<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>flex-wrap</title>
    <style type="text/css">
        /*
        flex-wrap:nowrap | wrap | wrap-reverse;
        nowrap（默认）：不换行。
        wrap：换行，第一行在上方。
        wrap-reverse：换行，第一行在下方。
        */

        .unit{
            width: 80px;
            height:50px;
            background:orange;
            margin:10px;
        }
        .box{
            display: flex;
            flex-direction:row;
            flex-wrap:wrap;
            border:1px solid #000;
            margin:10px;
            width: 500px;
            height:180px;
        }
        .box2{
            display: flex;
            flex-direction:row;
            flex-wrap:wrap-reverse;
            border:1px solid #000;
            margin:10px;
            width: 500px;
            height:180px;
        }
        .box3{
            display: flex;
            flex-direction:row-reverse;
            flex-wrap:wrap;
            border:1px solid #000;
            margin:10px;
            width: 500px;
            height:180px;
        }
        .box4{
            display: flex;
            flex-direction:row-reverse;
            flex-wrap:wrap-reverse;
            border:1px solid #000;
            margin:10px;
            width: 500px;
            height:180px;
        }
        .box5{
            display: flex;
            flex-direction:column;
            flex-wrap:wrap;
            border:1px solid #000;
            margin:10px;
            width: 250px;
            height:500px;
        }
        .box6{
            display:flex;
            flex-direction:column;
            flex-wrap:wrap-reverse;
            width: 250px;
            height:500px;
            border:1px solid #000000;
            margin:10px;
        }
        .box7{
            display:flex;
            flex-direction:column-reverse;
            flex-wrap:wrap;
            width: 250px;
            height:500px;
            border:1px solid #000000;
            margin:10px;
        }
        .box8{
            display:flex;
            flex-direction:column-reverse;
            flex-wrap:wrap-reverse;
            width: 250px;
            height:500px;
            border:1px solid #000;
            margin:10px;
        }
    </style>
</head>
<body>
<div class="box">
    <div class="unit">1</div>
    <div class="unit">2</div>
    <div class="unit">3</div>
    <div class="unit">4</div>
    <div class="unit">5</div>
    <div class="unit">6</div>
    <div class="unit">7</div>
    <div class="unit">8</div>
    <div class="unit">9</div>
</div>
<div class="box2">
    <div class="unit">1</div>
    <div class="unit">2</div>
    <div class="unit">3</div>
    <div class="unit">4</div>
    <div class="unit">5</div>
    <div class="unit">6</div>
    <div class="unit">7</div>
    <div class="unit">8</div>
    <div class="unit">9</div>
</div>
<div class="box3">
    <div class="unit">1</div>
    <div class="unit">2</div>
    <div class="unit">3</div>
    <div class="unit">4</div>
    <div class="unit">5</div>
    <div class="unit">6</div>
    <div class="unit">7</div>
    <div class="unit">8</div>
    <div class="unit">9</div>
</div>
<div class="box4">
    <div class="unit">1</div>
    <div class="unit">2</div>
    <div class="unit">3</div>
    <div class="unit">4</div>
    <div class="unit">5</div>
    <div class="unit">6</div>
    <div class="unit">7</div>
    <div class="unit">8</div>
    <div class="unit">9</div>
</div>
<div class="box5">
    <div class="unit">1</div>
    <div class="unit">2</div>
    <div class="unit">3</div>
    <div class="unit">4</div>
    <div class="unit">5</div>
    <div class="unit">6</div>
    <div class="unit">7</div>
    <div class="unit">8</div>
    <div class="unit">9</div>
</div>
<div class="box6">
    <div class="unit">1</div>
    <div class="unit">2</div>
    <div class="unit">3</div>
    <div class="unit">4</div>
    <div class="unit">5</div>
    <div class="unit">6</div>
    <div class="unit">7</div>
    <div class="unit">8</div>
    <div class="unit">9</div>
</div>
<div class="box7">
    <div class="unit">1</div>
    <div class="unit">2</div>
    <div class="unit">3</div>
    <div class="unit">4</div>
    <div class="unit">5</div>
    <div class="unit">6</div>
    <div class="unit">7</div>
    <div class="unit">8</div>
    <div class="unit">9</div>
</div>
<div class="box8">
    <div class="unit">1</div>
    <div class="unit">2</div>
    <div class="unit">3</div>
    <div class="unit">4</div>
    <div class="unit">5</div>
    <div class="unit">6</div>
    <div class="unit">7</div>
    <div class="unit">8</div>
    <div class="unit">9</div>
</div>
</body>
</html>
